//
//  UpdateToken.m
//  tingche
//
//  Created by 尤振宇 on 2017/6/27.
//  Copyright © 2017年 尤振宇. All rights reserved.
//

#import "UpdateToken.h"
#import "Config.h"
#import "Tool.h"

@implementation UpdateToken

-(void)requestWillStart:(id)request
{
    NSString *str = [Config Token];
    if (!str) {
        [request stop];
    }
}

- (void)requestDidStop:(id)request
{
    YTKRequest *ytkRequest = request;
    
    NSString *newToken = [ytkRequest.responseHeaders objectForKey:@"Authorization"];
    NSLog(@"newToken ========== %@",newToken);
    if (newToken) {
        [Config SetToken:newToken];
    }

}
@end
